class Solution {
public:
    vector<int> plusOne(vector<int>& digits) {
        vector<int> ans=digits;
        int carry=1,n=ans.size()-1;
        for(;n>=0;n--){
            ans[n]+=carry;
            carry=ans[n]/10;
            ans[n]=ans[n]%10;
        }
        if(carry!=0){
            ans.insert(ans.begin(),carry);
        }
        return ans;
    }
};